package com.sugar.queryinfo.module.business.dal.mysql.dataquerylsbg;

import com.sugar.queryinfo.framework.common.pojo.PageResult;
import com.sugar.queryinfo.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.queryinfo.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.queryinfo.module.business.controller.admin.data.dataquerylsbg.vo.DataQueryLsbgPageReqVO;
import com.sugar.queryinfo.module.business.dal.dataobject.dataquerylsbg.DataQueryLsbgDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 数据查询-流水报告 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface DataQueryLsbgMapper extends BaseMapperX<DataQueryLsbgDO> {

    default PageResult<DataQueryLsbgDO> selectPage(DataQueryLsbgPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataQueryLsbgDO>()
                .eqIfPresent(DataQueryLsbgDO::getUserId, reqVO.getUserId())
                .eqIfPresent(DataQueryLsbgDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(DataQueryLsbgDO::getDataId, reqVO.getDataId())
                .betweenIfPresent(DataQueryLsbgDO::getQueryTime, reqVO.getQueryTime())
                .eqIfPresent(DataQueryLsbgDO::getUrl, reqVO.getUrl())
                .betweenIfPresent(DataQueryLsbgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataQueryLsbgDO::getId));
    }

}